//
//  PushViewController.m
//  06-UINavigationController
//
//  Created by mafeng on 16/7/21.
//  Copyright © 2016年 mafeng. All rights reserved.
//

#import "PushViewController.h"

@interface PushViewController ()

@end

@implementation PushViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
   // self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemPlay target:self action:@selector(nibBundle)];
    button.backgroundColor = [UIColor cyanColor];
    button.frame = CGRectMake(0, 0, 100, 100);
    [button addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
}
- (void)back {
    // pop 当前Viewcontroller出栈, 返回上一级控制器
    [self.navigationController popViewControllerAnimated:YES];
    // 返回根视图控制器
    [self.navigationController popToRootViewControllerAnimated:YES];
    // 返回指定视图控制器 (一定要在栈中)
    // self.navigationController popToViewController:<#(nonnull UIViewController *)#> animated:<#(BOOL)#>
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
